# COVID-Refugees
 Replication files for JEPS "Refugees to the Rescue? Motivating Pro-Refugee Public Engagement during the COVID-19 Pandemic" by Claire Adida, Adeline Lo, Lauren Prather and Scott Williamson. Public registration details for the study can be found at: ____.

## Papers
* Manuscript `COVID_Refugees_ALPW.pdf` includes main text, appendix.

## Main code
All code for the Stage 2 Report (main and appendix) is conducted in the file `Replication Stage 2 Report.rmd`. For each of the following enumerated (1, 2, 3 …) sections, the starting name is the corresponding name of the r-chunk that conducts the tasks described. For instance **1. Data cleaning** refers to the r-chunk section called “Data cleaning”. Sections that take longer to run (e.g. simulations for the design) are currently set to eval=FALSE, and data objects are pre-saved as .rds objects and called for in evaluated chunks immediately after in evaluated sections producing tables/figures etc.

1. Data cleaning: Data pulled from `Data/Mustafa-Experiment-Oct-Final.png`, `Data/Kelli-Experiment-Oct-Final.png`. Combined with Facebook likes and comments data, outputs into `Data` folder. Note original screenshots of likes and comments cannot be included as they are identifiable -- unidentified summarizations are provided in `Data/Facebook_Likes_Comments_Data.csv`. This chunk creates:
* `mustafa.rds`
* `kelli.rds`
* `df.rds`
* `test_df`: includes t-test hypotheses info of all ads
* Generate Table 1

2. TestingH1: tests for H1 conducted and information stored
    •    Main data used throughout is `df.rds` : RDS object — data frame with 
    ⁃    ad information 
    ⁃    treatment information (`treatment_name`, `treatment`)
    ⁃    link click (`click`)
    ⁃    if there was a reaction (`reaction`)
    ⁃    ad like (`like`)
    ⁃    ad love (`love`)
    ⁃    ad care (`care`)
    ⁃    ad positive, combines like/love/care (`positive `)
    •    Main hypotheses tested throughout and results stored in `test_df`.
    •    Bayes’ factors calculated for a range of priors throughout, and saved. Outputs from bayes factor calculations of  `stan_glm` calls are stored and commented out for faster re-run of the code; saved objects include .rds files that are named in the following convention, followed by the two treatment arms they test (e.g. M1-M5 uses Mustafa ad 1 and Mustafa ad 5 data):
    ⁃    `mod_bf_small_`
    ⁃    `mod_bf_med_`
    ⁃    `mod_bf_large_`
3. TestingH2: tests for H2 conducted and information stored (exact same structure as TestingH1)

4. TestingH3: tests for H3 conducted and information stored (exact same structure as TestingH1)

5. SaveTesting: Saves the two main data frames from the Testing section, `df.rds` and `test_df.rds`

6. BH: conducts Benjamini-Hochberg tests.

7. Fig3Click: replicates Figure 3 “Click Rates for Ads” in main text.

8. Fig4Effects: replicates Figure 4 “Ad treatment effects” in main text.

9. Fig5Positive: replicates Figure 5 “Positive reactions to ads” in main text.

10. AppendixB: replicates simulations of the experimental design — submitted for Stage 1 Report. This includes post-experiment verification that power can be achieved using actualized N sizes in FB experiments. Produces Appendix Tables B.3-B.7, B.10-B.14.

11. AppendixD: replicates post experiment survey Table D.15.

12. AppendixG: replicates unregistered Bayes Factors Table G.16


For design analysis from Stage 1, please refer to `design.rmd` for full code. 
